package com.hdd.utils.wx;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @author ;xuhu
 * @Date: 2020-10-19 14:37
**/

@Component
public class UserPnUtil {

    @Autowired
    private RedisUtil redisUtil;

    public synchronized Long getPaintingNum(){
        long paintingNum = 0;
        Object wxPaintingNum = redisUtil.get("wx_paintingNum");
        if (wxPaintingNum == null) {
            paintingNum = 6000L;
            redisUtil.set("wx_paintingNum", paintingNum + 1L, -1);
        }else {
            paintingNum = Long.parseLong(wxPaintingNum.toString());
            redisUtil.set("wx_paintingNum", paintingNum + 1L, -1);
        }
        return paintingNum;
    }
}